//
//  YHModuleTwoViewController_1.m
//  YHRouter_Example
//
//  Created by 98du on 2021/11/26.
//  Copyright © 2021 林宁宁. All rights reserved.
//

#import "YHModuleTwoViewController_1.h"
#import "YHModuleTwoService.h"

@import YHRouter;
@interface YHModuleTwoViewController_1 ()

@end

@implementation YHModuleTwoViewController_1

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    YHOptionTableViewItem * item;
    
    item = YHOptionTableItemInitTitle(@"param", YES, YES);
    [item setCellClickBlock:^(NSIndexPath * _Nonnull indexPath, YHOptionTableViewItem * _Nonnull passItem) {
        [YHRouter yh_pushKey:@"YHModuleTwoViewController_2" params:[YHRouterParam params:@"pass params",@"张三",@(100), nil]];
    }];
    [self addOptionItem:item];
    
    item = YHOptionTableItemInitTitle(@"callback", YES, YES);
    [item setCellClickBlock:^(NSIndexPath * _Nonnull indexPath, YHOptionTableViewItem * _Nonnull passItem) {
        [YHRouter yh_pushKey:kYHModuleTwoViewController_2 config:^UIViewController * _Nullable(UIViewController * _Nonnull vc) {
            [vc setYh_callback:^(YHRouterParam * _Nullable passResult) {
                NSLog(@"%@",passResult.arg1);
            }];
            vc.yh_params([YHRouterParam params:@"call back action",@"jok",@(101), nil]);
            return vc;
        }];
    }];
    [self addOptionItem:item];
    
    item = YHOptionTableItemInitTitle(@"need login", YES, YES);
    [item setCellClickBlock:^(NSIndexPath * _Nonnull indexPath, YHOptionTableViewItem * _Nonnull passItem) {
        [YHRouter yh_pushKey:@"needlogin"];
    }];
    [self addOptionItem:item];
    
    item = YHOptionTableItemInitTitle(@"singleton", YES, YES);
    [item setCellClickBlock:^(NSIndexPath * _Nonnull indexPath, YHOptionTableViewItem * _Nonnull passItem) {
        [YHRouter yh_pushKey:@"YHModuleTwoViewController_4" params:[YHRouterParam params:@"origin content", nil]];
    }];
    [self addOptionItem:item];
    
    [self reloadContentView];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
